﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Wicresoft.EVM.Reporting
{
    public enum ReportViewer
    {
        VM_Report_Viewer = 1,
        Business_Service_Report_Viewer = 2,
        Cost_Report_Viewer = 4,
        Resource_Pool_Report_Viewer = 8,
        Request_Report_Viewer = 16,
    }

    static class ReportViewerUtil
    {
        private static IDictionary<string, ReportViewer> roles;
        public static IDictionary<string, ReportViewer> AllRoles
        {
            get
            {
                if (roles == null)
                {
                    roles = new Dictionary<string, ReportViewer>();

                    var names = Enum.GetNames(typeof(ReportViewer));
                    foreach (var name in names)
                    {
                        roles.Add(name.Replace('_', ' '), 
                            (ReportViewer)Enum.Parse(typeof(ReportViewer), name));
                    }
                }
                return roles;
            }
        }
    }
}